<?php
include("connection_settings.php");

//Strips " and ' marks
$bannedMarks = array("\"", "'");

$_GET['username'] = str_replace($bannedMarks, "", $_GET['username']);


//How many users
$table = mysql_query("SELECT COUNT(*) FROM users");
$userCount = mysql_result($table, 0, 0);

//Check if username already exists
$table = mysql_query("SELECT username FROM users");

for ($i = 0; $i < $userCount; $i++) {
 if (strtolower(mysql_result($table, $i, 0)) == strtolower($_GET['username'])) {
  echo "true";
  exit;
 }
}

echo "false";
?>